package com.woohua.thread.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/***
 * @title SingleThreadDemo
 * @description
 * @author woo hua
 * @version 1.0.0
 * @create 2023/3/17 16:45
 **/
public class SingleThreadDemo {

    public static void main(String[] args) {
        ExecutorService executorService = Executors.newSingleThreadExecutor();

        executorService.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + " made rice.");
            }
        });

        executorService.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + " made dish.");
            }
        });

        executorService.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + " clean up table.");
            }
        });

        executorService.shutdown();
    }
}
